#ifndef XANIMATION
#define XANIMATION
#include "../XModEngine/XObject.h"
#include "../XModEngine/vector.h"
#include "../XModEngine/Matrix.h"
#include "../XModEngine/XVertexBuffer.h"
#include "XBone.h"

struct XFrame{
public:
	Vector3 m_location;
	Quaternion m_rotation;
	float m_time = 1;
	XFrame(Vector3 loc, Quaternion rot){
		m_location = loc;
		m_rotation = rot;
	}
};
struct AnimInfo
{

	char Name[64];     // Animation's name
	char Group[64];    // Animation's group name	

	INT TotalBones;           // TotalBones * NumRawFrames is number of animation keys to digest.

	INT RootInclude;          // 0 none 1 included 	(unused)
	INT KeyCompressionStyle;  // Reserved: variants in tradeoffs for compression.
	INT KeyQuotum;            // Max key quotum for compression	
	FLOAT KeyReduction;       // desired 
	FLOAT TrackTime;          // explicit - can be overridden by the animation rate
	FLOAT AnimRate;           // frames per second.
	INT StartBone;            // - Reserved: for partial animations (unused)
	INT FirstRawFrame;        //
	INT NumRawFrames;         // NumRawFrames and AnimRate dictate tracktime...
};
class XAnimation : public XObject{
protected:
	XFrame* m_frames;
	int m_frame_count;
	string m_anim_name;
	int m_bone_count;
	float m_anim_rate;
public:
	XAnimation();
	~XAnimation();
	void InsertFrames(XFrame* data, int count);
	XFrame* GetFrames();
	void SetAnimationName(string name);
	string GetAnimationName();
	void UpdateSkeleton(vector<XBone*> skeleton, int frame);
	void SetTotalBones(int bones_num);
	int GetTotalBones();
	void SetAnimationRate(float rate);
	float GetAnimationRate();
	int GetFrameCount();
};
#endif